package simbot.example.task.push.group.info;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.DependsOn;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import simbot.example.service.push.info.animation.IAnimationInfoPushService;

import javax.annotation.Resource;

/**
 * 每日动画信息推送
 *
 * @author minmin
 * @since 2021/07/02 20:16
 */
@Component
@DependsOn("animationThreadPoolTaskScheduler")
public class DailyAnimationInfoTask {
    @Resource
    private IAnimationInfoPushService animationInfoPushService;

    @Value("${animation.push.toPushDailyAnimationInfo}")
    private boolean toPushDailyAnimationInfo;

    @Async
    @Scheduled(cron = "0 0 0 1/1 * ? ")
    public void animationInfoTask(){
        // 每日0点
        if (toPushDailyAnimationInfo){
            animationInfoPushService.pushInfo();
        }
    }
}
